﻿<UserControl x:Class="DevFX.Infrastructure.ViewUtility.UC.WaitCursorAnimation"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="Auto" Height="Auto">

    <UserControl.Resources>

        <Color x:Key="NormalCircleColor">#FFA7A6A6</Color>
        <Color x:Key="HighlightedCircleColor">#FFFFFFFF</Color>

        <SolidColorBrush x:Key="NormalCircleBrush" Color="{StaticResource NormalCircleColor}" />
        <SolidColorBrush x:Key="HighlightedCircleBrush" Color="{StaticResource HighlightedCircleColor}"/>

        <SolidColorBrush x:Key="WaitCursorBorderBrush" Color="#FF000000"/>

        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="WaitCursorBackgroundBrush">
            <GradientStop Color="#FF7A7777"/>
            <GradientStop Color="#FF181717" Offset="1"/>
        </LinearGradientBrush>

        <!-- Wait Animation Storyboard -->
        <Storyboard x:Name="CircleAnimation" RepeatBehavior="Forever">
            <ColorAnimationUsingKeyFrames Storyboard.TargetName="waitAnimationCircle06" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" BeginTime="00:00:00">
                <SplineColorKeyFrame KeyTime="00:00:00.4000000" Value="{StaticResource HighlightedCircleColor}"/>
                <SplineColorKeyFrame KeyTime="00:00:00.8000000" Value="{StaticResource NormalCircleColor}"/>
            </ColorAnimationUsingKeyFrames>

            <ColorAnimationUsingKeyFrames Storyboard.TargetName="waitAnimationCircle01" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" BeginTime="00:00:00">
                <SplineColorKeyFrame KeyTime="00:00:00.4000000" Value="{StaticResource NormalCircleColor}"/>
                <SplineColorKeyFrame KeyTime="00:00:02.4000000" Value="{StaticResource HighlightedCircleColor}"/>
            </ColorAnimationUsingKeyFrames>

            <ColorAnimationUsingKeyFrames Storyboard.TargetName="waitAnimationCircle02" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" BeginTime="00:00:00">
                <SplineColorKeyFrame KeyTime="00:00:00.8000000" Value="{StaticResource HighlightedCircleColor}"/>
                <SplineColorKeyFrame KeyTime="00:00:01.2000000" Value="{StaticResource NormalCircleColor}"/>
            </ColorAnimationUsingKeyFrames>

            <ColorAnimationUsingKeyFrames Storyboard.TargetName="waitAnimationCircle03" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" BeginTime="00:00:00">
                <SplineColorKeyFrame KeyTime="00:00:01.2000000" Value="{StaticResource HighlightedCircleColor}"/>
                <SplineColorKeyFrame KeyTime="00:00:01.6000000" Value="{StaticResource NormalCircleColor}"/>
            </ColorAnimationUsingKeyFrames>

            <ColorAnimationUsingKeyFrames Storyboard.TargetName="waitAnimationCircle04" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" BeginTime="00:00:00">
                <SplineColorKeyFrame KeyTime="00:00:01.6000000" Value="{StaticResource HighlightedCircleColor}"/>
                <SplineColorKeyFrame KeyTime="00:00:02.0000000" Value="{StaticResource NormalCircleColor}"/>
            </ColorAnimationUsingKeyFrames>

            <ColorAnimationUsingKeyFrames Storyboard.TargetName="waitAnimationCircle05" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" BeginTime="00:00:00">
                <SplineColorKeyFrame KeyTime="00:00:02.0000000" Value="{StaticResource HighlightedCircleColor}"/>
                <SplineColorKeyFrame KeyTime="00:00:02.4000000" Value="{StaticResource NormalCircleColor}"/>
            </ColorAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" 
          Visibility="Collapsed" 
          Width="76">

        <Border x:Name="brdWaitAnimation" 
                    BorderThickness="0" 
                    BorderBrush="{StaticResource WaitCursorBorderBrush}" 
                    Padding="5,10,5,10" 
                    Margin="0,0,0,0" 
                    Height="Auto" 
                    Width="Auto" 
                    Background="{StaticResource WaitCursorBackgroundBrush}"
                    >

            <Grid  ShowGridLines="False" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition />
                </Grid.RowDefinitions>

                <Ellipse x:Name="waitAnimationCircle01" 
                             Grid.Row="3" 
                             Grid.Column="1"  
                             Grid.ColumnSpan="2"  
                             Margin="0,-10,0,0"  
                             Height="16" 
                             Width="16" 
                             Fill="{StaticResource HighlightedCircleBrush}" />

                <Ellipse x:Name="waitAnimationCircle02" 
                             Grid.Row="1" 
                             Grid.Column="0" 
                             Margin="6,2,0,0"  
                             Height="16" 
                             Width="16" 
                             Fill="{StaticResource NormalCircleBrush}" />

                <Ellipse x:Name="waitAnimationCircle03" 
                             Grid.Row="0" 
                             Grid.Column="1" 
                             Grid.ColumnSpan="2" 
                             Margin="0,0,0,-10" 
                             Height="16" 
                             Width="16" 
                             Fill="{StaticResource NormalCircleBrush}" />

                <Ellipse x:Name="waitAnimationCircle04" 
                             Grid.Row="1" 
                             Grid.Column="3" 
                             Margin="0,0,6,0" 
                             Height="16" 
                             Width="16" 
                             Fill="{StaticResource NormalCircleBrush}"/>

                <Ellipse x:Name="waitAnimationCircle05" 
                             Grid.Row="2" 
                             Grid.Column="3" 
                             Margin="0,0,6,0" 
                             Height="16" 
                             Width="16" 
                             Fill="{StaticResource NormalCircleBrush}" />

                <Ellipse x:Name="waitAnimationCircle06" 
                             Grid.Row="2" 
                             Grid.Column="0" 
                             Margin="6,2,0,0"  
                             Height="16" 
                             Width="16" 
                             Fill="{StaticResource NormalCircleBrush}" />
            </Grid>
        </Border>
    </Grid>

</UserControl>